import axios from "axios"
import showMsg from "@/utils/showMessage.js"

const ins = axios.create()

ins.interceptors.response.use(resp => {
    const { data, msg, code } = resp.data
    if (code !== 0) {
        showMsg({
            content: msg,
            type: "error",
            duration: 3000
        })
        return null
    }
    return data
})

export { ins }